package com.cardone.platform.common.service;

import java.util.List;
import java.util.Map;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import com.cardone.common.cache.support.CacheEvictSupport;
import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.platform.common.dto.EntityTreeDto;

/**
 * 实体树服务
 *
 * @author yaohaitao
 */
public interface EntityTreeService {
	/**
	 * spring bean id
	 */
	String BEAN_ID = "com.cardone.platform.common.service.EntityTreeService";

	/**
	 * 保存:实体树
	 * 
	 * @param mappedClass
	 *            返回类型
	 * 
	 * @param saveEntityTree
	 *            实体树对象
	 * 
	 * @return 实体树对象
	 */
	@Deprecated
	@CacheEvict(value = EntityTreeService.BEAN_ID, allEntries = true)
	<P> P saveByIdOrCode(Class<P> mappedClass, EntityTreeDto saveEntityTree);

	/**
	 * 保存:实体树
	 * 
	 * @param saveEntityTree
	 *            实体树对象
	 * 
	 * @return 实体树对象
	 */
	@Deprecated
	@CacheEvict(value = EntityTreeService.BEAN_ID, allEntries = true)
	EntityTreeDto saveByIdOrCode(EntityTreeDto saveEntityTree);

	/**
	 * 插入
	 * 
	 * @param insertEntityTree
	 *            实体树对象
	 * 
	 * @return 影响行数
	 */
	@Deprecated
	@CacheEvict(value = EntityTreeService.BEAN_ID, allEntries = true)
	int insertByCode(EntityTreeDto insertEntityTree);
	
	/**
	 * 删除
	 * 
	 * @param deleteEntityTree
	 *            实体树对象
	 * 
	 * @return 影响行数
	 */
	@Deprecated
	@CacheEvict(value = EntityTreeService.BEAN_ID, allEntries = true)
	int deleteByIds(EntityTreeDto deleteEntityTree);

	/**
	 * 更新
	 * 
	 * @param updateEntityTree
	 *            实体树对象
	 * 
	 * @return 影响行数
	 */
	@Deprecated
	@CacheEvict(value = EntityTreeService.BEAN_ID, allEntries = true)
	int updateByCode(EntityTreeDto updateEntityTree);

	/**
	 * 查询
	 * 
	 * @param requiredType
	 *            返回类型
	 * 
	 * @param readEntityTree
	 *            实体树对象
	 * @return 返回数据
	 */
	@Deprecated
	@Cacheable(value = EntityTreeService.BEAN_ID, key = Caches.KEY_1)
	Integer readByCodeNqIdForCount(EntityTreeDto readEntityTree);
	
	/**
	 * 查询
	 * 
	 * @param mappedClass
	 *            返回类型
	 * 
	 * @param findEntityTree
	 *            实体树对象
	 * @return 返回对象
	 */
	@Deprecated
	@Cacheable(value = EntityTreeService.BEAN_ID, key = Caches.KEY_2)
	<P> P findById(Class<P> mappedClass, EntityTreeDto findEntityTree);

	/**
	 * 查询
	 * 
	 * @param mappedClass
	 *            返回类型
	 * 
	 * @param findEntityTree
	 *            实体树对象
	 * 
	 * @return 返回对象
	 */
	@Deprecated
	@Cacheable(value = EntityTreeService.BEAN_ID, key = Caches.KEY_2)
	<P> P findByCodeOrId(Class<P> mappedClass, EntityTreeDto findEntityTree);

	/**
	 * 查询
	 * 
	 * @param mappedClass
	 *            返回类型
	 * 
	 * @param findListEntityTree
	 *            实体树对象
	 * 
	 * @return 实体树对象集合
	 */
	@Deprecated
	@Cacheable(value = EntityTreeService.BEAN_ID, key = Caches.KEY_2)
	<P> List<P> findListByLikeCode(Class<P> mappedClass, EntityTreeDto findListEntityTree);

	/**
	 * 查询
	 * 
	 * @param mappedClass
	 *            返回类型
	 * 
	 * @return 实体树对象集合
	 */
	@Deprecated
	@Cacheable(value = EntityTreeService.BEAN_ID, key = Caches.KEY_1)
	<P> List<P> findList(Class<P> mappedClass);

	/**
	 * 分页
	 * 
	 * @param mappedClass
	 *            返回类型
	 * 
	 * @param paginationEntityTree
	 *            实体树对象
	 * 
	 * @return 实体树分页对象
	 */
	@Deprecated
	@Cacheable(value = EntityTreeService.BEAN_ID, key = Caches.KEY_2)
	<P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, EntityTreeDto paginationEntityTree);
}